package com.song.invoicing.mapper;

import com.github.pagehelper.Page;
import com.song.invoicing.pojo.dao.Product;
import com.song.invoicing.pojo.dao.PurchaseRecord;
import com.song.invoicing.pojo.dto.ProductQueryDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface ProductMapper {
    Page<Product> getProducts(ProductQueryDTO productQueryDTO);
    @Select("select * from invoicing.product where product_name=#{productName}")
    Product selectProductByProductName(String productName);

    void addNewProduct(Product newProduct);
    @Update("update invoicing.product set stock = stock + #{stock} where product_id=#{productId}")
    void addProductStock(Integer productId, Integer stock);
   @Update("update invoicing.product set price = #{price} where product_id=#{productId}")
    void updatePrice(Integer productId, Double price);
}
